<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<br>
<isperp:grid url="configuration/ciRelationType/list"
	gridId="ciRelationTypeGrid"
	ondbClickRowEvent="ciRelationTypeGrid.edit(rowid);"
	cusEditUrl="configuration/ciRelationType/edit"
	cusDeleteUrl="configuration/ciRelationType/delete"
	cusViewUrl="configuration/ciRelationType/view">

	<jsp:attribute name="toolbar">

	<isperp:toolbar id="ciRelationTypeToolbar">


		<isperp:button id="ciRelationTypeCreate" icon="icon-plus"
				text="新增配置关系类型" cssClass="nui-mainbtn"
				onclick="ciRelationTypeGrid.create();"></isperp:button>

			</isperp:toolbar>
	</jsp:attribute>

	<jsp:attribute name="searchbar">
	<table class="search-table">
		<tbody>
			<tr>
				<td class="td1">主关联资产类型：</td>
				<td class="td2"><input type="text" field="from_category_name"
						op="cn">
					</td>
				<td class="td1">被关联资产类型：</td>
				<td class="td2"><input type="text" field="to_category_name"
						op="cn">
					</td>
				
			</tr>
			<tr>
				<td class="td1">主关联别名：</td>
				<td class="td2"><input type="text"
						field="fromCategoryAliasName" op="cn">
					</td>
				<td class="td1">被关联别名：</td>
				<td class="td2"><input type="text" field="toCategoryAliasName"
						op="cn">
					</td>
				
			</tr>
		</tbody>
	</table>
	</jsp:attribute>
	<jsp:body>
	<isperp:column name="id" title="id" hidden="true"></isperp:column>
	<isperp:column name="name" title="名称" width="100">
	</isperp:column>
	<isperp:column name="fromCategoryName" title="主关联资产类型" width="120">
	</isperp:column>
		<isperp:column name="fromCategoryAliasName" title="主关联别名" width="100">
	</isperp:column>
	<isperp:column name="toCategoryName" title="被关联资产类型" width="120">
	</isperp:column>
		<isperp:column name="toCategoryAliasName" title="被关联别名" width="100">
	</isperp:column>
	</jsp:body>
</isperp:grid>


<script type="text/javascript">
	function rebuildAllRelation() {

		isperp.confirmAlert("您确定要根据现有的配置关系重新生成配置项的关联关系吗？<br><span style='color:red'>警告：此功能将会覆盖系统所有的资产关联关系，请谨慎使用！</span>", {
			yes : function() {
				isperp.showLoading();

				$.post("configuration/ciRelation/rebuildAll", function(data) {
					if (data.success) {
						isperp.alert("重建成功！");
					} else {
						isperp.errorAlert(data.data);
					}
					isperp.hideLoading();

				});
			}
		});

	}
</script>
